package com.timebank.volunteer.mapper;

import com.timebank.volunteer.pojo.entity.VolunteerList;
import com.timebank.volunteer.pojo.vo.VolunteerListVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 志愿服务参与名单
 * @author shiliuyinzhen
 */
@Mapper
public interface VolunteerListMapper {

    /**
     * 报名志愿服务
     * @param volunteerList
     * @return
     */
    int signUpVolunteer(VolunteerList volunteerList);

    /**
     * 查询用户是否已在参与名单中
     * @param volunteerList
     * @return
     */
    List<VolunteerList> selectVolunteerList(VolunteerList volunteerList);

    /**
     * 取消报名志愿服务
     * @param volunteerList
     * @return
     */
    int cancelSignUpVolunteer(VolunteerList volunteerList);

    /**
     * 获取参与名单
     * @param volunteerId
     * @return
     */
    List<VolunteerListVO> getVolunteerListById(Long volunteerId);

    /**
     * 批量删除志愿服务参与者
     * @param userIds
     * @param volunteerId
     * @return
     */
    int deleteVolunteerListByUserIds(@Param("userIds") Long[] userIds,@Param("volunteerId") Long volunteerId);

    /**
     * 根据志愿服务Ids删除志愿服务
     * @param volunteerIds
     * @return
     */
    int deleteVolunteerListByVolunteerIds(Long[] volunteerIds);

    /**
     * 条件查询志愿服务参与名单
     * @param volunteerList
     * @return
     */
    VolunteerList getVolunteerList(VolunteerList volunteerList);

    /**
     * 获取缺席名单
     * @param volunteerId
     * @param userIds
     * @return
     */
    List<VolunteerListVO> getAbsentListById(@Param("volunteerId") Long volunteerId, @Param("userIds") List<Long> userIds);
}
